<template>
  <div>
    <!-- 用于跳转页面 -->
    <router-link to="/foo">跳转Foo页面</router-link> |
    <router-link to="/bar">跳转Bar页面</router-link>
    <button @click="goto">手动跳转</button>

    <router-view></router-view>
  </div>
</template>

<script>
export default {
  methods: {
    goto() {
      alert("走咯");
      this.$router.push("/foo");
    },
  },
};
</script>

<style scoped>
.router-link-active {
  color: red;
  text-decoration: none;
}
</style>
